﻿namespace DimOS.DimFS
{
    public class Attributes
    {
        public bool System { get; set; }   //Indicates that node is used by system
        public bool TempDir { get; set; }  //Marks the node as temporary directory
        public bool UserDir { get; set; }  //Marks node as a user-access directory
        public bool Settings { get; set; } //Indicates that node contains settings
        public bool Journal { get; set; }  //Marks the node as the command history
        public bool HelpFile { get; set; } //Marks the node as command's help file
        public bool Query { get; set; }    //Marks the node as system search query

        public Attributes(bool system, bool tempDir, bool userDir, bool settings,
                          bool journal, bool helpFile, bool query)
        {
            System = system;
            TempDir = tempDir;
            UserDir = userDir;
            Settings = settings;
            Journal = journal;
            HelpFile = helpFile;
            Query = query;
        }

        public static Attributes Default()
        { return new Attributes(false, false, false, false, false, false, false); }

        public static bool Compare(Attributes required, Attributes target)
        {
            if ((required.System && !target.System) || (required.TempDir&& !target.TempDir) ||
                (required.UserDir && !target.UserDir) || (required.Settings && !target.Settings) ||
                (required.Journal && !target.Journal) || (required.HelpFile && !target.HelpFile) ||
                (required.Query && !target.Query)) return false;
            return true;
        }
    }
}
